home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Dev / ace23.lha / PRGS.lha / Turtle / dragon.b < prev    next >
Text File  |  1994-10-02  |  697b  |  47 lines

  1. '..Dragon Curve 
  2. '..(recursive).
  3.  
  4. sub dragon(depth,side)
  5.  if depth = 0 then
  6.    Forward(side)
  7.  else
  8.    if depth > 0 then
  9.     dragon(depth-1,side)
  10.     turnRight(90)
  11.     dragon(-(depth-1),side)
  12.    else
  13.     dragon(-(depth+1),side)
  14.     turnRight(270)
  15.     dragon(depth+1,side)
  16.    end if
  17.  end if
  18. end sub
  19.  
  20. window 1,"Dragon Curve",(0,0)-(640,250),6
  21. font "topaz",8
  22. color 2,1
  23.  
  24. another$="Y"
  25. while another$="Y"
  26.  cls
  27.  locate 1,1
  28.  input "Enter depth (try 10): ",depth 
  29.  input "Enter sides (try 3):  ",sides 
  30.  
  31.  cls
  32.  
  33.  penup
  34.  setxy 320,125
  35.  pendown
  36.  dragon(depth,sides)
  37.  
  38.  locate 26,1
  39.  print "another (y/n)?"
  40.  another$=""
  41.  while another$<>"Y" and another$<>"N"
  42.    another$=ucase$(inkey$)
  43.  wend
  44. wend
  45.  
  46. window close 1
  47.